﻿using Microsoft.EntityFrameworkCore;
using Model;
using System;
using System.Collections.Generic;
using System.Text;

namespace EntityFramework
{
    public class MyDbContext : DbContext
    {
        public MyDbContext(DbContextOptions<MyDbContext> options) : base(options)
        {

        }
        /// <summary>
        /// 用户表
        /// </summary>
        public DbSet<T_Log> T_Log { get; set; }
        public DbSet<T_Address> T_Address { get; set; }
        public DbSet<T_PointsDetail> T_PointsDetail { get; set; }
        public DbSet<T_PointsRule> T_PointsRule { get; set; }
        public DbSet<T_SYS_Area> T_SYS_Area { get; set; }
        public DbSet<T_SYS_City> T_SYS_City { get; set; }
        public DbSet<T_SYS_Province> T_SYS_Province { get; set; }
        public DbSet<T_User> T_User { get; set; }
        public DbSet<T_Activity> T_Activity { get; set; }
        public DbSet<T_ActivityDetail> T_ActivityDetail { get; set; }
        public DbSet<T_AdminUser> T_AdminUser { get; set; }
        public DbSet<T_BlackList> T_BlackList { get; set; }
        public DbSet<T_DrawModel> T_DrawModel { get; set; }
        public DbSet<T_ExchangeModel> T_ExchangeModel { get; set; }
        public DbSet<T_Poster> T_Poster { get; set; }
        public DbSet<T_PrizeModel> T_PrizeModel { get; set; }
        public DbSet<T_Report> T_Report { get; set; }
        public DbSet<T_VipModel> T_VipModel { get; set; }
        public DbSet<T_Join> T_Join { get; set; }
        public DbSet<T_BuyRecord> T_BuyRecord { get; set; }
        
        public DbSet<T_Form> T_Form { get; set; }
        public DbSet<T_Graphic> T_Graphic { get; set; }

        
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<T_Log>().ToTable(nameof(T_Log)).HasKey(a => a.Id);
            modelBuilder.Entity<T_Address>().ToTable(nameof(T_Address)).HasKey(a => a.Id);
            modelBuilder.Entity<T_PointsDetail>().ToTable(nameof(T_PointsDetail)).HasKey(a => a.Id);
            modelBuilder.Entity<T_PointsRule>().ToTable(nameof(T_PointsRule)).HasKey(a => a.Id);
            modelBuilder.Entity<T_SYS_Area>().ToTable(nameof(T_SYS_Area)).HasKey(a => a.Code);
            modelBuilder.Entity<T_SYS_City>().ToTable(nameof(T_SYS_City)).HasKey(a => a.Code);
            modelBuilder.Entity<T_SYS_Province>().ToTable(nameof(T_SYS_Province)).HasKey(a => a.Code);
            modelBuilder.Entity<T_User>().ToTable(nameof(T_User)).HasKey(a => a.Id);
            modelBuilder.Entity<T_Activity>().ToTable(nameof(T_Activity)).HasKey(a => a.Id);
            modelBuilder.Entity<T_ActivityDetail>().ToTable(nameof(T_ActivityDetail)).HasKey(a => a.Id);
            modelBuilder.Entity<T_AdminUser>().ToTable(nameof(T_AdminUser)).HasKey(a => a.Id);
            modelBuilder.Entity<T_BlackList>().ToTable(nameof(T_BlackList)).HasKey(a => a.Id);
            modelBuilder.Entity<T_DrawModel>().ToTable(nameof(T_DrawModel)).HasKey(a => a.Id);
            modelBuilder.Entity<T_ExchangeModel>().ToTable(nameof(T_ExchangeModel)).HasKey(a => a.Id);
            modelBuilder.Entity<T_Poster>().ToTable(nameof(T_Poster)).HasKey(a => a.Id);
            modelBuilder.Entity<T_PrizeModel>().ToTable(nameof(T_PrizeModel)).HasKey(a => a.Id);
            modelBuilder.Entity<T_Report>().ToTable(nameof(T_Report)).HasKey(a => a.Id);
            modelBuilder.Entity<T_VipModel>().ToTable(nameof(T_VipModel)).HasKey(a => a.Id);
            modelBuilder.Entity<T_Join>().ToTable(nameof(T_Join)).HasKey(a => a.Id);
            modelBuilder.Entity<T_BuyRecord>().ToTable(nameof(T_BuyRecord)).HasKey(a => a.Id);
            modelBuilder.Entity<T_Form>().ToTable(nameof(T_Form)).HasKey(a => a.Id);
            modelBuilder.Entity<T_Graphic>().ToTable(nameof(T_Graphic)).HasKey(a => a.Id);

            
        }
    }
}
